<template>
<div>
    <el-button type="look" @click="dialogVisible = true" v-if="_SHOWBTN(showBetCode)">审核</el-button>

    <el-dialog :title="modular" :visible.sync="dialogVisible" width="1160px">
        <h1>{{tableList.title}}</h1>
        <h2>
            来源：{{tableList.source}}
            <span>|</span>
            发布时间：{{tableList.publishTime}}
        </h2>
        <div class="text-body ql-container ql-snow">
            <h3 class="ql-editor" v-html="tableList.context"></h3>
        </div>
        <div class="height-130"></div>
        <!--审核界面send-->
        <span slot="footer" class="dialog-footer">
            <div class="text-input">
                <div class="title">审核意见</div>
                <el-input type="textarea" :rows="2" placeholder="填写信息受理意见，打回时必填。" v-model="textarea"></el-input>

            </div>
            <div class="bt-group">
                <el-button @click="back">打回</el-button>
                <el-button type="primary" @click="adopt">通过</el-button>
            </div>
        </span>
    </el-dialog>
</div>
</template>

<script>
export default {
    components: {},
    data() {
        return {
            dialogVisible: false,
            textarea: "",
            tableList: {},
        };
    },
    props: ["state", "row", "gettRotationList", "modular", "showBetCode"],
    created() {
        this.choice();
        this.getDetail();
    },
    methods: {
        getDetail() {
            //依恋课堂
            this.Api.getForumClassEach({
                id: this.row.id,
            }).then((res) => {
                this.tableList = res.data;
                // console.log(this.tableList, "依恋课堂详情")
            });
        },
        choice() {
            if (this.state == 1) {
                this.com = "Send";
            } else if (this.state == 2) {
                this.com = "Success";
            } else if (this.state == 4) {
                this.com = "";
            }
        },
        adopt() {
            this.Api.getForumClasschoise({
                auditContext: this.textarea,
                bussId: this.row.id,
                publishStatus: 2,
            }).then((res) => {
                if (res.code === "0") {
                    this.dialogVisible = false;

                    this.gettRotationList();
                }

            });
        },
        back() {
            if (this.textarea.length > 0) {
                this.Api.getForumClasschoise({
                    auditContext: this.textarea,
                    bussId: this.row.id,
                    publishStatus: 3,
                }).then((res) => {
                    if (res.code === "0") {
                        this.dialogVisible = false;
                        this.gettRotationList();
                    }

                });
            } else {
                this.$message.warning("审核意见不能为空");
            }
        },
    },
};
</script>

<style lang="less" scoped>
/deep/.el-dialog {
    min-height: 886px;
    margin-top: 8vh !important;
    border-radius: 8px;
    position: relative;

    .el-dialog__footer {
        position: absolute;
        bottom: 0;
        padding: 0 40px 20px 40px;
    }

    >.el-dialog__header {
        padding: 15px 0px 15px 24px;
        background: rgba(230, 233, 237, 1);
        border-radius: 8px 8px 0 0;
        display: flex;

        >.el-dialog__title {
            width: 90px;
            height: 16px;
            font-size: 18px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: rgba(51, 51, 51, 1);
        }

        >.el-dialog__headerbtn {
            right: 11px;
        }
    }

    >.el-dialog__body {
        padding: 30px 40px 0 40px;

        >h1 {
            font-size: 28px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: rgba(51, 51, 51, 1);
            line-height: 28px;
            padding: 0px 0 25px 0;
            text-align: center;
            white-space: normal;
            word-break: break-all;
            word-wrap: break-word;
        }

        >h2 {
            height: 22px;
            font-size: 16px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(153, 153, 153, 1);
            line-height: 22px;
            text-align: center;
            margin: 0 auto;
            padding-bottom: 30px;
            border-bottom: 1px solid #e8e8e8;
            margin-bottom: 23px;

            >span {
                display: inline-block;
                margin: 0 10px;
            }
        }

        .text-body {
            >h3 {
                font-size: 16px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(51, 51, 51, 1);
                line-height: 32px;
                margin-bottom: 32px;
                text-align: left;
            }

            .indent-2 {
                text-indent: 2em;
            }
        }
    }
}

/deep/.el-button--look {
    width: 60px;
    height: 28px;
    background: rgba(245, 166, 35, 1);
    border-radius: 4px;
    color: #ffffff;
    padding: 0;
    margin-right: 20px !important;
}

h3 {
    white-space: normal;
}

//send
.dialog-footer {
    .text-input {
        display: flex;
        margin-bottom: 20px;

        .title {
            width: 80px;
            height: 80px;
            font-size: 14px;
            line-height: 22px;
            color: rgba(51, 51, 51, 1);
            background: rgba(242, 242, 242, 1);
            border: 1px solid rgba(221, 221, 221, 1);
            padding: 18px 22px 0px 25px;
            white-space: normal;
        }

        >.el-textarea {
            /deep/ .el-textarea__inner {
                min-height: 80px !important;
                width: 1005px;
                padding-left: 9px;
            }
        }
    }

    .bt-group {
        display: flex;
        justify-content: flex-end;

        .el-button--default {
            width: 80px;
            height: 36px;
            background: rgba(251, 54, 63, 1);
            border-radius: 3px;
            border: 1px solid rgba(251, 54, 63, 1);
            padding: 0;
            color: #ffffff;
        }

        .el-button--primary {
            padding: 0;
            color: #ffffff;
            width: 80px;
            height: 36px;
            background: rgba(61, 127, 255, 1);
            border-radius: 3px;
        }
    }
}

.height-130 {
    height: 166px;
}
</style>
